import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'
import BusinessList from '../views/BusinessList.vue'
import Login from '../views/Login.vue'
import BusinessInfo from '../views/BusinessInfo.vue'
import Orders from '../views/Orders.vue'
import UserAddress from '../views/UserAddress.vue'
import Payment from '../views/Payment.vue'
import OrderList from '../views/OrderList.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Index
  },
  {
    path: '/index',
    name: 'index',
    component: Index
  },
  {
	  path:'/businessList',
	  name:'BusinessList',
	  component:BusinessList
  },
  {
	 path:'/login',
	 name:'Login',
	 component:Login
  },
  {
	 path:'/businessInfo',
	 name:'BusinessInfo',
	 component:BusinessInfo
  },
  {
	 path:'/orders',
	 name:'Orders',
	 component:Orders
  },
  {
	 path:'/userAddress',
	 name:'UserAddress',
	 component:UserAddress
  },
  {
	 path:'/payment',
	 name:'Payment',
	 component:Payment
  },
  {
	 path:'/orderList',
	 name:'OrderList',
	 component:OrderList
  }
]

//解决重复路由异常
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location){
	return originalPush.call(this,location).catch(err=>err)
}


const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
